<?php
class newsModel extends model{
	public $base;
	public function __construct(&$base){
		parent::__construct($base);
		$this->table="news";
	}
	
	public function getListByIds($newsids){
		$option=array(
			"where"=>" newsid in("._implode($newsids).")   "
		);
		$data=$this->select($option);
		if($data){
			foreach($data as $k=>$v){
				$t[$v['newsid']]=$v;
			}
			return $t;
		}
		return false;
	}
	
	public function get($newsid){
		$newsid=intval($newsid);
		$row=$this->selectRow("newsid=".$newsid);
		if($row){
			if($row['imgsdata']){
				$row['imgsdata']=explode(",",$row['imgsdata']);
			}else{
				$row['imgsdata']="";
			} 
			$user=M("user")->selectRow("userid=".$row['userid']);
			$row['nickname']=$user['nickname'];
			$row['user_head']=$user['user_head'];
		}
		return $row;
	}
}

?>